export default{
	init:(Vue)=>{
		
		/**
		 * 获取设备的基础信息
		 */
		Vue.prototype.get_window_info = function() {
			let obj = uni.getSystemInfoSync();
			//屏幕宽
			let windowWidth = obj.windowWidth;
			let window_width = windowWidth;
			//屏幕宽	
			let screenWidht = obj.screenWidth;
			let screen_widht = screenWidht;
			//不包含状态栏和导航栏的高
			let windowHeight = obj.windowHeight;
			let window_height = windowHeight;
			// 手机全屏高
			let screenHeight = obj.screenHeight;
			let screen_height = screenHeight;
			//定义css最小高度为全屏
			let cssMinHeight = "min-height:" + window_height + "px;";
			let css_min_height = cssMinHeight;
			//定义css高度样式为全屏
			let css_height = "height:" + windowHeight + "px;";
		
			// #ifdef MP
			css_height = "height:calc(" + windowHeight + "px - 44px);";
			// #endif
		
			let cssHeight = css_height;
			//顶部导航栏高度
			let nav_bar_height = obj.navigationBarHeight;
			let navBarHeight = nav_bar_height;
			//客户端类型，如 Android IOS
			let platform = obj.platform;
			//环境类型 如MP-WIXIN MP-PAY MP-TOUTIAO H5 APP 
			let app_platform = obj.AppPlatform;
			let AppPlatform = app_platform;
			//状态栏高度
			let status_bar_height = obj.statusBarHeight;
			let statusBarHeight = status_bar_height;
			
			
			
			
			return {
				screenWidht: screenWidht,
				screen_widht: screen_widht,
				screenHeight: screenHeight,
				screen_height: screen_height,
				css_min_height: css_min_height,
				cssMinHeight: cssMinHeight,
				windowHeight: windowHeight,
				window_height: window_height,
				windowWidth: windowWidth,
				window_width: window_width,
				AppPlatform: AppPlatform,
				app_platform: app_platform,
				platform: platform,
				os: platform,
				navBarHeight: navBarHeight,
				nav_bar_height: nav_bar_height,
				cssHeight: cssHeight,
				css_height: css_height,
				statusBarHeight: statusBarHeight,
				status_bar_height: status_bar_height,
				...Vue.prototype.get_doc_height()
			}
		}
		/**
		 * 获取状态栏高度
		 */
		Vue.prototype.get_status_bar_height = () => {
			return uni.getSystemInfoSync().statusBarHeight;
		}
		Vue.prototype.get_doc_height = function() {
			let systemInfo = uni.getSystemInfoSync();
			let status_height = systemInfo.statusBarHeight;
			let nav_height = 0;
			let nav_height_no = 0;
			// #ifdef APP-PLUS || H5
				nav_height = 44;
				// #ifdef H5
					nav_height = 44;
				// #endif
			// #endif
			
			// #ifdef MP
				nav_height = systemInfo.platform == 'ios' ? 44 : 44;
			// #endif
			let ct_height = status_height + nav_height;
			let ct_height_no_nav = status_height + nav_height_no;
			let navStyle = ct_height + "px";
			
			let sticky_offsettop = status_height * 2 + nav_height * 2 - 6;
			// #ifdef H5
				sticky_offsettop = 0;
			// #endif
			return {
				ns_doc_height: systemInfo.windowHeight - nav_height,
				doc_height: systemInfo.windowHeight - ct_height,
				doc_height_css:"height:" + (systemInfo.windowHeight - ct_height) + "px",
				ct_height: ct_height,
				nav_height: nav_height,
				sticky_offsettop:sticky_offsettop,
				ns_nv_doc_height_css:"height:" + (systemInfo.windowHeight - ct_height_no_nav) + "px",
				ns_doc_height_css: "height:" + (systemInfo.windowHeight - ct_height) + "px"
			}
		}
		Vue.prototype.sysinfo = Vue.prototype.get_window_info();
	}
}